package com.wenda.admin.constant;


import com.wenda.admin.vo.SelectNode;

import java.util.ArrayList;
import java.util.List;

/**
 * 该接口用于表述枚举类型
 */
public interface IConvertable {
    int getId();

    String getName();

    static List<SelectNode> toSelect(IConvertable[] enums){
        List<SelectNode> list = new ArrayList<SelectNode>();
        list.add(new SelectNode("",""));
        if(enums == null || enums.length == 0){
            return list;
        }

        for(IConvertable c:enums){
            list.add(new SelectNode(c.getId()+"",c.getName()));
        }
        return list;
    }
}
